﻿using DAL;
using Model.medical;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL
{
    public class MedicationBLL
    {
        public MedicationDAL MedicationDAL { get; }

        public MedicationBLL(MedicationDAL medicationDAL)
        {
            MedicationDAL = medicationDAL;
        }
        /// <summary>
        /// 用药添加
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int MedicaAdd(MedicationModel info)
        {
            try
            {
                return MedicationDAL.MedicaAdd(info);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 显示查询分页
        /// </summary>
        /// <param name="totalCount"></param>
        /// <param name="totalPage"></param>
        /// <param name="Pageindex"></param>
        /// <param name="pageSize"></param>
        /// <param name="Dispensingdoctors"></param>
        /// <param name="DepartId"></param>
        /// <returns></returns>
        public IQueryable<Medication> GetMedicatioList(out int totalCount, out int totalPage, int Pageindex = 1, int pageSize = 2, string? Dispensingdoctors = "", int? DepartId = null)
        {
            try
            {
                return MedicationDAL.GetMedicatioList(out totalCount, out totalPage, Pageindex, pageSize, Dispensingdoctors, DepartId);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// Id查询反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public MedicationModel GetMedicationId(int id)
        {
            try
            {
               return MedicationDAL.GetMedicationId(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int MedicaDelete(int id)
        {
            try
            {
              return MedicationDAL.MedicaDelete(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 批量修改状态
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public int MedicaUptAll(string ids, int state)
        {
            try
            {
               return MedicationDAL.MedicaUptAll(ids, state);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int MedicaUpt(MedicationModel info)
        {
            try
            {
                return MedicationDAL.MedicaUpt(info);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
